<?php /* Smarty version 2.6.20, created on 2017-09-14 20:18:09
         compiled from grade.htm */ ?>
<?php require_once(SMARTY_CORE_DIR . 'core.load_plugins.php');
smarty_core_load_plugins(array('plugins' => array(array('modifier', 'strip_tags', 'grade.htm', 205, false),array('modifier', 'truncate', 'grade.htm', 205, false),)), $this); ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>会员级别</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link href="admin.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="../script/jquery-1.4.4.min.js"></script>
<script type="text/javascript" src="../script/jquery.validation.min.js"></script>
<script type="text/javascript" src="../script/my_lightbox.js"></script>
<script>
$(function(){
	$('#form').validate({
		errorPlacement: function(error, element){
			element.next('.form-error').append(error);
		},      
		rules : {
			name:{
				required:true
			},
			demand:{
				digits:true
			},
			valid:{
				digits:true
			},
			sum:{
				number:true
			},
			rate:{
				number:true
			}
			
		},
		messages : {
			name:{
				required:"请填写级别名称",
			},
			demand:{
				digits:"必须输入整数"
			},
			valid:{
				digits:"必须输入整数"
			},
			sum:{
				number:"必须输入合法的数字"
			},
			rate:{
				number:"必须输入合法的数字"
			}
		}
	});
});
</script>
</head>
<body>
	<div class="container">
        <div class="flow">
            <div class="itemtitle">
                <h3>会员级别</h3>
                <ul>
                    <li <?php if ($_GET['operation'] == ''): ?>class="current"<?php endif; ?>><a href="?m=member&s=grade.php"><span>管理</span></a></li>
                    <li <?php if ($_GET['operation'] == 'add'): ?>class="current"<?php endif; ?>><a href="?m=member&s=grade.php&operation=add"><span>添加</span></a></li>
                    <?php if ($_GET['operation'] == 'edit'): ?>
                    <li class="current"><a href="#"><span>修改</span></a></li>
                    <?php endif; ?>
                </ul>
            </div>
        </div>
        <div class="h35"></div>  
        <?php if ($_GET['operation'] == 'add' || $_GET['operation'] == 'edit'): ?>
            <form name="form" id="form" method="post">
            <input name="id" type="hidden" id="id" value="<?php echo $this->_tpl_vars['de']['id']; ?>
">
            <table class="table">
                <thead>
                    <tr>
                        <th class="partition" colspan="99">会员级别</th>
                    </tr>
                </thead>
                
                <tbody>
                <tr>
                    <td width="100">级别名称</td>
                    <td>
                    <input name="name" id="name" type="text" class="w350" value="<?php echo $this->_tpl_vars['de']['name']; ?>
"><div id="form-error" class="form-error"></div>
                    </td>
                </tr>
                
                <?php if ($this->_tpl_vars['de']['id'] != 1): ?>
                <tr>
                    <td>条件</td>
                    <td>
                    <input name="demand" id="demand" type="text" class="w350" value="<?php if ($this->_tpl_vars['de']['demand']): ?><?php echo $this->_tpl_vars['de']['demand']; ?>
<?php else: ?>0<?php endif; ?>"><div id="form-error" class="form-error"></div>
                   </td>
                </tr>
                <?php else: ?>
                <input name="demand" type="hidden" value="<?php echo $this->_tpl_vars['de']['demand']; ?>
">
                <?php endif; ?>
                
                <?php if ($this->_tpl_vars['de']['id'] != 1): ?>
                <tr>
                    <td>有效期</td>
                    <td>
                    <input name="valid" id="valid" type="text" class="w350" value="<?php if ($this->_tpl_vars['de']['valid']): ?><?php echo $this->_tpl_vars['de']['valid']; ?>
<?php else: ?>0<?php endif; ?>"><div id="form-error" class="form-error"></div><p>单位：年 为0时，无限期</p>
                    </td>
                </tr>
                <?php else: ?>
                <input name="valid" type="hidden" value="<?php echo $this->_tpl_vars['de']['valid']; ?>
">
                <?php endif; ?>
                
                <?php if ($this->_tpl_vars['de']['id'] != 1): ?>
                <tr>
                    <td>年费</td>
                    <td>
                    <input name="sum" id="sum" type="text" class="w350" value="<?php if ($this->_tpl_vars['de']['sum']): ?><?php echo $this->_tpl_vars['de']['sum']; ?>
<?php else: ?>0<?php endif; ?>"><div id="form-error" class="form-error"></div>
                    </td>
                </tr>
                <?php else: ?>
                <input name="sum" type="hidden" value="<?php echo $this->_tpl_vars['de']['sum']; ?>
">
                <?php endif; ?>
                
                <tr>
                    <td>小图</td>
                    <td>
                    <input name="logo" type="text" id="logo" class="w350" value="<?php echo $this->_tpl_vars['de']['logo']; ?>
">
                    [<a href="javascript:uploadfile('上传LOGO','logo',17,17,'')">上传</a>] 
                    [<a href="javascript:preview('logo');">预览</a>]
                    [<a onclick="javascript:$('#logo').val('');" href="#">删除</a>]
                    </td>
                </tr>
                
                <tr>
                    <td>大图</td>
                    <td>
                    <input name="blogo" type="text" id="blogo" class="w350" value="<?php echo $this->_tpl_vars['de']['blogo']; ?>
">
                    [<a href="javascript:uploadfile('上传LOGO','blogo',65,65,'')">上传</a>] 
                    [<a href="javascript:preview('blogo');">预览</a>]
                    [<a onclick="javascript:$('#blogo').val('');" href="#">删除</a>]
                    </td>
                </tr>
                
                <tr>
                    <td>折扣率</td>
                    <td>
                    <input name="rate" id="rate" type="text" class="w350" value="<?php if ($this->_tpl_vars['de']['rate']): ?><?php echo $this->_tpl_vars['de']['rate']; ?>
<?php else: ?>0<?php endif; ?>"><div id="form-error" class="form-error"></div>
                    </td>
                </tr>
				<script charset="utf-8" src="<?php echo $this->_tpl_vars['config']['weburl']; ?>
/lib/kindeditor/kindeditor-min.js"></script>
                <script>
                var editor;
                KindEditor.ready(function(K) {editor = K.create('textarea[name="treatment"]', {});});
                </script>
                <tr>
                    <td>权益</td>
                    <td><textarea style="width:100%" class="w343" name="treatment"><?php echo $this->_tpl_vars['de']['treatment']; ?>
</textarea></td>
                </tr>

                <tr>
                    <td>&nbsp;</td>
                    <td>
                    <input class="submit" type="submit" value="提交">
                    <input name="act" type="hidden" id="action" value="<?php if (! $_GET['editid']): ?>save<?php else: ?>edit<?php endif; ?>">
                    </td>
                </tr>
                
                </tbody>
            </table>
            </form>
        <?php else: ?>
		<script type="text/javascript">
        $(function(){
            /* 全选 */
             $('.checkall').click(function(){
                var _self = this;
                $('.checkitem').each(function(){
                    if (!this.disabled)
                    {
                        $(this).attr('checked', _self.checked);
                    }
                });
                $('.checkall').attr('checked', this.checked);
            });	 
        });
        </script>
        <form action="" method="post">
        <table class="table">
            <tbody>
                <tr class="header partition">
                    <th width="30"></th>
                    <th width="130">名称</th>
                    <th width="150">条件</th>
                    <th width="90">有效期</th>
                    <th width="90">年费</th>
                    <th width="90">折扣率</th>
                    <th>权益</th>
                    <th width="50"></th>
                </tr>
                <?php $_from = $this->_tpl_vars['de']['list']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }if (count($_from)):
    foreach ($_from as $this->_tpl_vars['list']):
?>
                <tr>
                    <td><input type="checkbox" <?php if ($this->_tpl_vars['list']['id'] == 1): ?>disabled="disabled"<?php endif; ?> value="<?php echo $this->_tpl_vars['list']['id']; ?>
" class="checkitem" name="chk[]"></td>
                    <td><?php echo $this->_tpl_vars['list']['name']; ?>
</td>
                    <td><?php if ($this->_tpl_vars['list']['id'] == 1): ?>注册成功<?php else: ?><?php if ($this->_tpl_vars['list']['demand'] <= 1): ?>购买过商品<?php else: ?><?php echo $this->_tpl_vars['list']['demand']; ?>
(含)以上<?php endif; ?><?php endif; ?></td>
                    <td><?php if ($this->_tpl_vars['list']['valid'] == 0): ?>无限期<?php else: ?><?php echo $this->_tpl_vars['list']['valid']; ?>
年<?php endif; ?></td>
                    <td><?php echo $this->_tpl_vars['config']['money']; ?>
<?php echo $this->_tpl_vars['list']['sum']; ?>
</td>
                    <td><?php echo $this->_tpl_vars['list']['rate']; ?>
%</td>
                    <td><?php echo ((is_array($_tmp=((is_array($_tmp=$this->_tpl_vars['list']['treatment'])) ? $this->_run_mod_handler('strip_tags', true, $_tmp) : smarty_modifier_strip_tags($_tmp)))) ? $this->_run_mod_handler('truncate', true, $_tmp, 80) : smarty_modifier_truncate($_tmp, 80)); ?>
</td>
                    <td>
                    <a href="?m=member&s=grade.php&operation=edit&editid=<?php echo $this->_tpl_vars['list']['id']; ?>
"><?php echo $this->_tpl_vars['editimg']; ?>
</a> 
                    <?php if ($this->_tpl_vars['list']['id'] != 1): ?><a onclick="return confirm('确定删除吗');" href="?m=member&s=grade.php&delid=<?php echo $this->_tpl_vars['list']['id']; ?>
"><?php echo $this->_tpl_vars['delimg']; ?>
</a><?php endif; ?>
                    </td>
                </tr>
                <?php endforeach; else: ?>
                <tr>
                    <td class="norecord" colspan="99"><i></i><span>暂无符合条件的数据记录</span></td>
                </tr>
                <?php endif; unset($_from); ?>
            </tbody>
            <tfoot>
                <tr>
                	<td colspan="2">
                        <input type="checkbox" class="checkall" id="del">
                        <input type="hidden" name="act" value="op" />
                        <input type="submit" value="提交" />
                    </td>
                    <td colspan="99"><div class="page"><?php echo $this->_tpl_vars['de']['page']; ?>
</div></td>
                </tr>
            </tfoot>
        </table>
        </form>
        <?php endif; ?>
    </div>
</body>
</html>